﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SendCustomerOpinion.ascx.cs"
  Inherits="ITViet.Web.Controls.SendCustomerOpinion" %>
<%@ Register Assembly="DevExpress.Web.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dxpc" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
  Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="MSCaptcha" Namespace="MSCaptcha" TagPrefix="cc1" %>
<%@ Register Assembly="DevExpress.Web.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dxcb" %>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<table width="100%">
  <tr>
    <td>
      <%=GetGlobalResourceObject("Strings", "FullName")%><span class="not_null"> (*)</span>
      :
    </td>
    <td>
      <dxe:ASPxTextBox ID="txtFullName" ClientInstanceName="txtFullName" runat="server"
        Width="200px">
      </dxe:ASPxTextBox>
    </td>
  </tr>
  <tr>
    <td>
      <%=GetGlobalResourceObject("Strings", "Email")%><span class="not_null"> (*)</span>:
    </td>
    <td>
      <dxe:ASPxTextBox ID="txtEmail" ClientInstanceName="txtEmail" runat="server" Width="200px">
      </dxe:ASPxTextBox>
    </td>
  </tr>
  <tr>
    <td>
      <%=GetGlobalResourceObject("Strings", "Phone")%>:
    </td>
    <td>
      <dxe:ASPxTextBox ID="txtPhone" ClientInstanceName="txtPhone" runat="server" Width="200px">
      </dxe:ASPxTextBox>
    </td>
  </tr>
  <tr>
    <td>
      <%=GetGlobalResourceObject("Strings", "Address")%>:
    </td>
    <td>
      <dxe:ASPxTextBox ID="txtAddress" ClientInstanceName="txtAddress" runat="server" Width="200px">
      </dxe:ASPxTextBox>
    </td>
  </tr>
  <tr>
    <td>
      <%=GetGlobalResourceObject("Strings", "Title")%>:
    </td>
    <td>
      <dxe:ASPxTextBox ID="txtTitle" ClientInstanceName="txtTitle" runat="server" Width="200px">
      </dxe:ASPxTextBox>
    </td>
  </tr>
  <tr>
    <td>
      <%=GetGlobalResourceObject("Strings", "Content")%><span class="not_null"> (*)</span>:
    </td>
    <td>
      <dxe:ASPxMemo ID="mmOpinion" ClientInstanceName="mmOpinion" runat="server" Width="280px"
        Height="100px">
      </dxe:ASPxMemo>
    </td>
  </tr>
  <tr>
    <td>
      <%=GetGlobalResourceObject("Strings", "SafeCode") %><span class="not_null"> (*)</span>:
    </td>
    <td>
      <div style="float: left; padding: 10px 3px 0 0;">
        <dxe:ASPxTextBox ID="txtSafeCode" ClientInstanceName="txtSafeCode" runat="server"
          Width="100px">
        </dxe:ASPxTextBox>
      </div>
      <div style="float: left">
        <asp:UpdatePanel ID="upCaptcha" runat="server" UpdateMode="Conditional">
          <ContentTemplate>
            <cc1:CaptchaControl ID="ccSafeCode" runat="server" CaptchaBackgroundNoise="None"
              CaptchaLength="5" CaptchaWidth="180" CaptchaMinTimeout="5" CaptchaMaxTimeout="240"
              LineColor="Black" BackColor="#DBD8D5" Width="180px" EnableViewState="True" CaptchaHeight="40"
              CaptchaLineNoise="High" />
          </ContentTemplate>
        </asp:UpdatePanel>
      </div>
    </td>
  </tr>
  <tr>
    <td>
    </td>
    <td style="padding-top: 10px;">
      <a href="" onclick="onCancel();return false;" class="button">
        <%=GetGlobalResourceObject("Strings", "Cancel") %>
      </a><a href="" onclick="onSend();return false;" class="button">
        <%=GetGlobalResourceObject("Strings", "Send") %>
      </a>
    </td>
  </tr>
</table>
<dxcb:ASPxCallback ID="cbOpinion" runat="server" ClientInstanceName="cbOpinion" OnCallback="cbOpinion_Callback">
  <ClientSideEvents CallbackComplete="function(s, e) {cbOpinion_CallbackComplete(s, e);}" />
</dxcb:ASPxCallback>
<dxpc:ASPxPopupControl ID="pupAlertMessage" runat="server" ClientInstanceName="pupAlertMessage"
  HeaderText="<%$Resources:Strings, Info %>" PopupHorizontalAlign="WindowCenter"
  PopupVerticalAlign="WindowCenter" Width="350px" AutoUpdatePosition="True" Modal="True">
  <SizeGripImage Height="12px" Width="12px" />
  <ContentCollection>
    <dxpc:PopupControlContentControl ID="PopupControlContentControl1" runat="server">
      <table>
        <tr>
          <td align="left">
            <dxe:ASPxLabel ID="lblAlertMessage" runat="server" ClientInstanceName="lblAlertMessage"
              Text="" ForeColor="Red">
            </dxe:ASPxLabel>
          </td>
        </tr>
        <tr>
          <td align="center" style="padding-top: 5px;">
            <dxe:ASPxButton ID="ASPxButton1" runat="server" Text="OK" AutoPostBack="false">
              <ClientSideEvents Click="function(s, e){
              clearAlertMessage();
            }" />
            </dxe:ASPxButton>
          </td>
        </tr>
      </table>
    </dxpc:PopupControlContentControl>
  </ContentCollection>
  <CloseButtonImage Height="18px" Width="18px" />
  <HeaderStyle>
    <Paddings PaddingTop="1px" PaddingLeft="10px" PaddingRight="6px" />
  </HeaderStyle>
</dxpc:ASPxPopupControl>

<script type="text/javascript" language="javascript">
//  __doPostBack('<%=upCaptcha.ClientID %>', '');
  function cbOpinion_CallbackComplete(s, e) {
    if (e.result != '') {
      alert(e.result);
    }
    else {
      alertMessage('<%=(string)GetGlobalResourceObject("Messages","ERR0035") %>');
      onCancel();
    }
    __doPostBack('<%=upCaptcha.ClientID %>', '');
  }

  function onSend() {
    if (txtFullName.GetText() == '' || txtEmail.GetText() == '' || mmOpinion.GetText() == '') {
      
      alertMessage('<%=(string)GetGlobalResourceObject("Messages","ERR0028") %>');
     // alert('<%=(string)GetGlobalResourceObject("Messages","ERR0028") %>');
      return;
    }
    if (!ValidateEmail(txtEmail.GetText())) {
      
      alertMessage('<%=(string)GetGlobalResourceObject("Messages","ERR0029") %>');
      //alert('<%=(string)GetGlobalResourceObject("Messages","ERR0029") %>');
      return;
    }
    cbOpinion.PerformCallback('Send');
  }

  function onCancel() {
    txtFullName.SetText('');
    txtTitle.SetText('');
    txtEmail.SetText('');
    txtPhone.SetText('');
    txtAddress.SetText('');
    mmOpinion.SetText('');
    txtSafeCode.SetText('');
  }

  function alertMessage(msg) {
    lblAlertMessage.SetText(msg);
    pupAlertMessage.Show();
  }



  function clearAlertMessage() {
    lblAlertMessage.SetText('');
    pupAlertMessage.Hide();
    __doPostBack('<%=upCaptcha.ClientID %>', '');
  }



</script>

